package com.freemyleft.left.zapp.ui.recycler;

import java.util.ArrayList;

/**
 * Created by YangFan on 2017/9/26.
 * 数据转化的约束类
 */

public abstract class DataConverter {

    protected final ArrayList<MultipleItemEntity> ENTITIES = new ArrayList<>();
    private String mJsonData = null;

    private int type = 0;

    public DataConverter setType(int type) {
        this.type = type;
        return this;
    }

    protected int getType() {
        return type;
    }

    public abstract ArrayList<MultipleItemEntity> convert();

    public DataConverter setJsonData(String json) {
        this.mJsonData = json;
        return this;
    }

    protected String getJsonData() {
        if (mJsonData == null || mJsonData.isEmpty()) {
            throw new NullPointerException("数据是空的，请检查");
        }
        return mJsonData;
    }
    public void clearData(){
        ENTITIES.clear();
    }
}
